home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume4 / conquer3 / part01 next >
Encoding:
Internet Message Format  |  1988-06-16  |  58.3 KB

  1. Path: uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games
  2. From: games@tekred.TEK.COM
  3. Newsgroups: comp.sources.games
  4. Subject: v04i042:  conquer3 - middle earth multi-player game (V3), Part01/08
  5. Message-ID: <2651@tekred.TEK.COM>
  6. Date: 16 Jun 88 21:35:21 GMT
  7. Sender: billr@tekred.TEK.COM
  8. Lines: 1804
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted by: ihnp4!homxc!smile
  12. Comp.sources.games: Volume 4, Issue 42
  13. Archive-name: conquer3/Part01
  14.  
  15.     [Here's the latest version of Ed Barlow's conquer (conquest)
  16.      game. It has lots of enhancements and bug fixes.  I have
  17.      compiled this, so I know all of the requisite files are
  18.      here (unlike last time :-)).  -br]
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 1 (of 8)."
  27. # Contents:  README MANIFEST display.c newlogin.c
  28. # Wrapped by billr@saab on Thu Jun 16 09:39:55 1988
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f README -a "${1}" != "-c" ; then 
  31.   echo shar: Will not over-write existing file \"README\"
  32. else
  33. echo shar: Extracting \"README\" \(15481 characters\)
  34. sed "s/^X//" >README <<'END_OF_README'
  35. X
  36. X            NOTES TO INSTALLER OF CONQUER
  37. X
  38. XWhat you have here is a copyrighted release 3 version version of CONQUER.  
  39. XI make no guaranties to the sanity or style of this code, but do believe
  40. Xthat it should work as documented.  I have included numerous bugfixes
  41. Xfrom previous releases posting, and have added numerous enhancements. 
  42. X
  43. XMy current email address is {ihnp4}!homxc!smile.  I try to answer all
  44. Xmail, but sometimes it is dificult.  All feature requests that are sent
  45. Xin will be considered, and these are my primary method of deciding what
  46. Xto add to the code.  Your interest is appreciated.
  47. XNote that I only work on Conquer out of work hours, and so sometimes it
  48. Xwill take a while to get to it.
  49. X
  50. XIncluded in this file are the following:
  51. X
  52. X    1) A Brief Description of Conquer
  53. X    2) Installation (unpacking) Instructions
  54. X    3) Configuration Instructions
  55. X    4) Compilation Instructions
  56. X    5) Administration instructions
  57. X    6)   Changes in this version
  58. X    7)   Problems that I know about are or desired changes
  59. X
  60. XThis version should not be redistributed. 
  61. XAny comments and bug reports would be appreciated.
  62. X
  63. X-----------------------------------------------------------
  64. XI   A Brief Description of Conquer
  65. X-----------------------------------------------------------
  66. X
  67. XREAD the files "man.page" and "conquer.docs" for a description of
  68. Xconquer.  Conquer.docs is equivalent to the on line help, found in
  69. Xthe file "help".  These two documents are created when the program
  70. Xis compiled.  I have tried to make the documentation as good as possible,
  71. Xbut I guarantee that I have missed a lot.
  72. X
  73. X-----------------------------------------------------------
  74. XII  Installation (unpacking) Instructions
  75. X-----------------------------------------------------------
  76. X
  77. XThis program came in several shar scripts, which can be unpacked
  78. Xby using "sh filename".  If you are reading this, you know this.
  79. X
  80. XIf you suspect missing files, please check the MANIFEST.
  81. X
  82. X-----------------------------------------------------------
  83. XIII Configuration
  84. X-----------------------------------------------------------
  85. X
  86. XTHE FOLLOWING FILES SHOULD BE MODIFIED TO REFLECT YOUR ENVIRONMENT
  87. XAND THE TYPE OF GAME YOU WISH TO PLAY.
  88. X
  89. Xheader file:    header.h    modify as per instructions
  90. X             data.h        probably needs no modifications
  91. Xmakefile:    Makefile    modify as per instructions
  92. X
  93. XI have tried to comment this stuff appropriately.
  94. X
  95. XThe options specified in the configuration files will be reflected
  96. Xin the conquer.docs and help files when the program is compiled.
  97. X
  98. X-----------------------------------------------------------
  99. XIV  Compilation Instructions
  100. X-----------------------------------------------------------
  101. X
  102. XBrowse the file header.h.  This sets up configurable parameters for the
  103. Xgame.  This program should be easy to compile.  Just type make.
  104. X
  105. XNote: Sometimes curses does not include termcap or termlib.  If all the
  106. X    '.c' files get compiled, but do not compile together,  and 
  107. X    unreferenced symbol errors occur,  try adding "-ltermcap" after
  108. X    the "-lcurses" line in the makefile.
  109. X
  110. X-----------------------------------------------------------
  111. XV   administration instructions
  112. X-----------------------------------------------------------
  113. X
  114. XNow that you have compiled it, this is how you administer the game.
  115. XI recommend following these instructions once yourself in a mock game 
  116. X(ie. no other players) for a few turns to get things straight.  Then you 
  117. Xcan add other players.
  118. X
  119. XYou can type the following commands to help administer the game
  120. X
  121. Xmake:        Compiles the code.
  122. Xmake clobber:   Clobber everything but the source (destroys executables)
  123. Xmake clean:     Clean up objects (does not destroy executables)
  124. Xmake new_game:    Create a new game, make world, add players...
  125. Xmake docs:    Creates documentation from help file
  126. X
  127. Xrun:        read this shell script, it permits you to run the update
  128. X        automatically.  It needs to be modified for time to update.
  129. X
  130. XThe command line for the two executables created can be found by reading
  131. Xthe help files.  The admin executable is for the game super user only,
  132. Xand the conquer executable is for the players.
  133. X
  134. XAgain, prior to the compile, you should have followed the instructions
  135. Xin the Makefile and in header.h.  
  136. X
  137. XYou can administrate world either via "make new_game" or via:
  138. X    <admin -m>    this will make your world.  
  139. X             This also sets up npc nations as per the nations file
  140. X             npc stats can be adjusted by editing nations
  141. X             prior to making the world.  Non player nations have
  142. X             the same password as god.
  143. X
  144. XAdd 0 or more players via
  145. X    <admin -a>    which should be self explanatory
  146. X
  147. X
  148. XOnce you log in as a player or as god, you can get help by
  149. Xtyping '?'.  Play around with the commands and get your syntax right.
  150. X
  151. XTry logging in as either a player or non player nation (they use the super
  152. Xuser password) and noticing any differences.
  153. X
  154. XIMPORTANT FOR PLAY BALANCE: 
  155. XThe world is not created equal.  Some players may start in very bad
  156. Xpositions.  You can either start them over (destroy that nation in the
  157. Xchange nation command and create a new one), or modify the surrounding
  158. Xterain appropriately (god can use the redesignate command to change
  159. Xelevation and vegitation).
  160. XNow move around on the map and learn where the players are
  161. Xpositioned.  If there is a problem (they are surrounded by water...), 
  162. Xuse the redesignate command to change elevation or vegetation. 
  163. XIn the worst case, god can destroy a nation
  164. Xwith 'c', the change nation command.  Once you
  165. Xthink the game will be fair, it is time to allow players to proceed.
  166. X
  167. XNow you are all set -- play via 
  168. X    <conquer>
  169. X
  170. Xand update with <admin -x> via an script similar to the one contained in "run". 
  171. X
  172. X-----------------------------------------------------------
  173. XVI   Changes in this version
  174. X-----------------------------------------------------------
  175. X
  176. XThe following changes have been added in this version (v3).
  177. X
  178. X1) Peasant revolts should turn 25% of populace into militia. 
  179. X2) nations in revolt have unique names.
  180. X3) Ships no longer can move overland
  181. X4) NPCs should only able to get WARRIOR type, MONSTER type, KNOWALL, DERVISH,
  182. X    DESTROYER, HIDDEN, VOID, ARCHITECT, VAMPIRE, HEALER, MINER, BREEDER, 
  183. X    URBAN, and STEEL, ARCHER POWERS, SLAVER
  184. X    NPCs now utilize powers. If ARCHER => all non militia units = ARCHER
  185. X5) Lizard armies are limited in how far they can wander
  186. X6) Warrior power is now used by NPCs in recruitment
  187. X7) added getopt.c for ibm pc's     /* need to test it */
  188. X8) Ship costs increased 
  189. X9) tyranny class name changed to warlord
  190. X10) new random events -- 
  191. X    volcano strikes country, earthquake, tornado, general prosperity.
  192. X11) added percentage chance that a volcano will go off somewhere on the globe.
  193. X12) added lockfile mechanism to prevent players from logging in twice.
  194. X13) creation of mountains based on map sized    /* need to test */
  195. X14) fixed the mail editor so it processes only
  196. X    printable characters and so vt220 delete key works.
  197. X15) fort,gold,and iron should be char
  198. X16) added starting # of people... for enforcement in drafting
  199. X17) moved startgold and startpeople stuff to execute.c
  200. X18) Iron for new units several places was not updated.
  201. X19) now use drand48() on sysV and random() on BSD instead of rand()
  202. X20) NPCs now have militia in all their cities.  NPC militia must not move.
  203. X21) Help file should give more details on races, diplomacy, army stats.
  204. X22) passwrod prompt made more explicit 
  205. X23) magic powers now broken up more logically (magic/civilian/military)
  206. X    more powers added.  Powers should effect units you can build.
  207. X    added use of powers[i], getnumpowers(type,country), 
  208. X    and getmgkcost(type,country)
  209. X24) added data.c
  210. X25) added hangup routine... need to test.
  211. X26) added control L redraw on movement screen... need to test
  212. X27) Split the game into 2 functioning units:  Move Entry and
  213. X       Move Execution.  This will help players on pc's.
  214. X28) prevent countries from taking themselves over
  215. X29) limited number of mercenaries to 1/2 your regular troops
  216. X30) Fixed destroyer power... destroyers can redesignatie their sectors.
  217. X    if they lose the sector, it reverts to desert.  All sectors in
  218. X    the radius now become desert
  219. X31) reproduction and production fall off if too many people are in a sector 
  220. X32) make production ability fall off with increasing usage.  Each ??? mined
  221. X    gives 100% chance of reducing the iron/jewel value of a sector by one 
  222. X33) ???% chance of a sector gaining 1 point of iron/jewels in a turn.
  223. X34) Changed the markers so that they are consistent.  
  224. X    Upper case  - nation marks
  225. X    Lower case  - sector designations (rename cities to towns)
  226. X        char *ele=       "#^%-~";
  227. X        char *des=       "ctmfx$!-";
  228. X        char *veg=       "vdyblgwfjsi~";
  229. X35) Magic screen should permit use of magic spells.
  230. X36) It should take min(75,tmil/150) to take over sector only for pcs
  231. X37) Classes: all classes should start with some sort of magic powers.
  232. X38) new screen option for showing food value.
  233. X39) joined ninja and spy powers
  234. X40) reworked npc movement
  235. X41) Modified the header.h file so that TAXFOOD is only 40, and TAXIRON is 60, 
  236. X    TAXJEWELS is 80.  This should significantly reduce the amount
  237. X       of gold that nations have to play with.  
  238. X42) Add elephant unit type 
  239. X43) -D game to make smaller executables
  240. X44) added extended commands
  241. X45) Added slaver power
  242. X46) Made buying a city cost a larger amount of money.
  243. X47) Made spreadsheet() for update,reports,npcs which returns structure of
  244. X    information on production abilities.
  245. X48) intelligent npc sector redesignation
  246. X49) have broken down my pceattr, atkattr, and defendattr() routines
  247. X    into components... the building blocks of strategies.  
  248. X    These strategies have not been implemented but for example are...
  249. X
  250. X    peaceful expand, peaceful hold, attack_empty_sectors(country),
  251. X    survival, fortify, build, attack(nation number), jihad(nation number),
  252. X    attack_army(nation), jihad_army(nation), take(race)..., 
  253. X    defend(nation), defend_army(nation), etc...
  254. X
  255. XThese will be pulled together into a list of "strategies" which will
  256. Xbe stored in the active variable in the nation strucutre.  The higher
  257. Xthe number, the more likely the nation will be to jihad() against PC's.
  258. XLow numbered nations will not be likely to instigate a war...
  259. Xwill need to write an additional diplomacy routine.
  260. X50) Rewrote Makefile
  261. X
  262. X51) "verifying that nation x exists" string changed to "Loading nation x".
  263. X52) integer and nation name input allows better deletion.
  264. X53) OGOD option will allow the god to have greater power
  265. X    (remove magic and give magic) as well as tightening security.
  266. X54) DERVDESG option will change DERVISH (and DESTROYER) power
  267. X    so that they will be able to redesignate sectors instead of
  268. X    the previous automatic food generation. (may have desert mines,
  269. X    towns, etc...)
  270. X55) rewrote tofood so that it was passed the country
  271. X    number as well as a vegetation.  (this means that display food
  272. X    will show 6 for deserts with DERVISH power)
  273. X56) HIDELOC option will make it so that the news will not print
  274. X    the sector locations for battles and randomevents. (had to create
  275. X    a disaster report that is mailed to PC players so that they can
  276. X    know where a tornado or earthquake etc... struck.)
  277. X57) saw what you did with newhelp.c and build it up so fixed it
  278. X    so that it would work to create a new help file. NOTE: make sure
  279. X    that the help file is moved to help.txt after being patched.
  280. X    Look at the makefile to see what I mean.  
  281. X58) altered randevent.c so that it would select a city/mine/goldmine
  282. X    at random, not starting from the upperleft.
  283. X59) altered display in BUDGET and PRODUCTION so that it will not be
  284. X    ruined with nations started getting 500000 or more people.
  285. X60) prettified all of the things that seemed a little off.
  286. X61) did stuff to newlogin to make it beautiful
  287. X62) Miscelaneous V2.2 fixes.
  288. X    Fixed bug that generated too many nomads... now new
  289. X        nomads are based on a nations military might
  290. X    Stopped Mercenary troops from depleting population
  291. X    Fixed News section bug that lists "Country A and B declare ceasefire" 
  292. X        followed by "Country B declares war on A" 
  293. X    Lowered town cost to 100000.
  294. X63)
  295. XShould force defeated armies to retreat if battle lost and not city
  296. X-----------------------------------------------------------
  297. XVII   Problems that I know about are or desired changes
  298. X-----------------------------------------------------------
  299. X
  300. Xplatinum to add add to spell points at 25K per point.
  301. XSector ownership rules must change - capture on 8:1 odds always.
  302. XShould have SEIGE and SEIGED status for armies
  303. X
  304. XChange movement so that when you move into a sector you don't own (that is also
  305. Xnot owned bya friend or ally) you either stop automatically or at least use
  306. Xmore movement, say twice normal to scout it out.
  307. X
  308. Xnew powers :
  309. X    TRADER : Generally has very good diplomacy status, half cost to
  310. X        construct and maintain merchant ships
  311. X
  312. Xallow nations to redesignate a sector to devastated if they
  313. X    wish, which discourages their populace from inhabiting it.
  314. X
  315. Xkeep track of the date... I should use a variable in nation 0
  316. X    (how about its location variable...).
  317. X
  318. Xmake newlogin give nations added after the starting date extra points
  319. Xbased on the scores of the PC nations playing.  This is not for
  320. Xrebel nations.  
  321. X
  322. Xchange readnews, fleetrpt, and armyrpt slightly so they only redraw the
  323. X    screen if you have something to look at.
  324. X
  325. XMake the update keep track of which PC's didn't move and at the end of the
  326. Xupdate it puts a copy of the news for that turn into their message files.
  327. XMake the update keep a copy of the newsfile in a turn log as well, which
  328. Xwill keep news files from all turns in a game, and in the future I will
  329. Ximplement a command that allows you to look up the log for a particular turn
  330. Xfrom within the program, in place of the news command.
  331. X
  332. Xadded to randevents so it prints a message of what happened to the nation
  333. X     it affected.  This probably isn't really necessary now since players 
  334. X    that miss turns will have the news saved, but I did it before I 
  335. X    implemented the news saving.  I do need to add several message 
  336. X    printings to the new/newly implemented randevents, though.
  337. X
  338. Xrebel nations should have unique names - from table & unique nation marks
  339. XShould have ubiquitous castle designation.  
  340. X
  341. XShips will now have 50 man crews - which can melee and fight. 
  342. X    Troops are required on ships.
  343. X    Each fleet may carry one army of Marines (in addition to any troops 
  344. X    that are ferried - who dont count in combat).  Marines add to chances
  345. X    of success in shipboard combat.  
  346. X
  347. XSea combat - 3 rounds
  348. X    get nwarships nmerchants
  349. X    get nmarines/shp nsailors/shp
  350. X    each warship ship ram 20% (+10% if SAILOR) - will sink
  351. X    Boarding 
  352. X        get nsolds (nships*sold/ship) and bonus (weighted average)
  353. X        use normal combat
  354. X        casualties are applied to ships!!! only -> 30% chance
  355. X            of collecting prize from boarding
  356. XFortifications should be demolished in combats by catapults or siege engines.  
  357. X
  358. XI have written a
  359. Xlittle trading system, and will send it to you, but I need just one
  360. Xthing:  a command in the execute file that does *increment* of
  361. Xgold, jewels, iron and food, rather than adjusting the absolute value.
  362. XCould you add that for me quickly?  I really think it would
  363. Xbe worth it.
  364. X
  365. XThere is a problem with the logic of sector taking. I have
  366. Xhad three sectors taken w/out battle from underneath my soldiers. The armies
  367. Xwere never more than three times greater (and that is pushing). Plus, one of
  368. Xthem, the latest, took my sector with exactly 112 soldiers to my 80 (I now
  369. Xhave the ninja power, so I know for sure). The sector is taken, but NOT listed
  370. Xas taken in the NEWS. (The people are killed and the sector devastated,
  371. Xhowever) 
  372. END_OF_README
  373. if test 15481 -ne `wc -c <README`; then
  374.     echo shar: \"README\" unpacked with wrong size!
  375. fi
  376. # end of overwriting check
  377. fi
  378. if test -f MANIFEST -a "${1}" != "-c" ; then 
  379.   echo shar: Will not over-write existing file \"MANIFEST\"
  380. else
  381. echo shar: Extracting \"MANIFEST\" \(1074 characters\)
  382. sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
  383. X   File Name        Archive #    Description
  384. X-----------------------------------------------------------
  385. X FILESIZES                 3    
  386. X MANIFEST                  1    This shipping list
  387. X Makefile                  4    
  388. X README                    1    
  389. X admin.c                   8    
  390. X cexecute.c                8    
  391. X combat.c                  2    
  392. X commands.c                4    
  393. X data.c                    8    
  394. X data.h                    6    
  395. X display.c                 1    
  396. X extcmds.c                 8    
  397. X forms.c                   7    
  398. X getopt.c                  7    
  399. X header.h                  7    
  400. X help.txt                  3    
  401. X io.c                      5    
  402. X magic.c                   6    
  403. X main.c                    6    
  404. X makeworld.c               4    
  405. X man.page                  8    
  406. X misc.c                    3    
  407. X move.c                    7    
  408. X nations                   5    
  409. X newhelp.c                 8    
  410. X newlogin.c                1    
  411. X newlogin.h                8    
  412. X npc.c                     2    
  413. X randevent.c               5    
  414. X reports.c                 7    
  415. X run                       8    
  416. X update.c                  5    
  417. END_OF_MANIFEST
  418. if test 1074 -ne `wc -c <MANIFEST`; then
  419.     echo shar: \"MANIFEST\" unpacked with wrong size!
  420. fi
  421. # end of overwriting check
  422. fi
  423. if test -f display.c -a "${1}" != "-c" ; then 
  424.   echo shar: Will not over-write existing file \"display.c\"
  425. else
  426. echo shar: Extracting \"display.c\" \(9939 characters\)
  427. sed "s/^X//" >display.c <<'END_OF_display.c'
  428. X/*Print and io subroutines for interactive game*/
  429. X
  430. X/*conquer : Copyright (c) 1988 by Ed Barlow.
  431. X *  I spent a long time writing this code & I hope that you respect this.
  432. X *  I give permission to alter the code, but not to copy or redistribute
  433. X *  it without my explicit permission.  If you alter the code,
  434. X *  please document changes and send me a copy, so all can have it.
  435. X *  This code, to the best of my knowledge works well,  but it is my first
  436. X *  'C' program and should be treated as such.  I disclaim any
  437. X *  responsibility for the codes actions (use at your own risk).  I guess
  438. X *  I am saying "Happy gaming", and am trying not to get sued in the process.
  439. X *                                                Ed
  440. X */
  441. X
  442. X/*include files*/
  443. X#include <ctype.h>
  444. X#include "header.h"
  445. X#include "data.h"
  446. X
  447. X/*Declarations*/
  448. Xextern struct s_sector sct[MAPX][MAPY];
  449. Xextern struct nation ntn[NTOTAL];   /* player nation stats */
  450. X
  451. X/*offset of upper left hand corner*/
  452. Xextern short xoffset;
  453. Xextern short yoffset;
  454. X/*current cursor postion (relative to 00 in upper corner)*/
  455. X/*    position is 2*x,y*/
  456. Xextern short xcurs;
  457. Xextern short ycurs;
  458. X/*redraw map in this turn if redraw is a 1*/
  459. Xextern short redraw;
  460. X/*display state SEE data.h FOR CURRENT VALUES OF THESE */
  461. Xextern short hilmode;
  462. Xextern short dismode;
  463. X/* nation id of owner*/
  464. Xextern short country;
  465. X
  466. X/*make a map*/
  467. Xvoid
  468. Xmakemap()
  469. X{
  470. X    register int x,y;
  471. X    register int i,j;
  472. X    short armynum,nvynum;
  473. X
  474. X    /*can you see all?*/
  475. X    if((magic(country,KNOWALL)==1)||(country==0)) {
  476. X        for(x=0;x<SCREEN_X_SIZE;x++) {
  477. X            for(y=0;y<(LINES-4);y++) {
  478. X                highlight(x,y);
  479. X                see(x,y);
  480. X            }
  481. X        }
  482. X        if((hilmode==HI_ARMY)||(hilmode==HI_MOVE)||(hilmode==HI_YARM)) {
  483. X            for(armynum=0;armynum<MAXARM;armynum++)
  484. X            if((ASOLD>0)&&((AMOVE>0)||(hilmode!=4))){
  485. X                standout();
  486. X                see(AXLOC-xoffset,AYLOC-yoffset);
  487. X            }
  488. X        }
  489. X    }
  490. X    /*see as appropriate?*/
  491. X    else {
  492. X        for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<(LINES-4);y++) {
  493. X            if(sct[x+xoffset][y+yoffset].owner==country){
  494. X                for(i=x-LANDSEE;i<=x+LANDSEE;i++){
  495. X                    for(j=y-LANDSEE;j<=y+LANDSEE;j++) {
  496. X                        highlight(i,j);
  497. X                        see(i,j);
  498. X                    }
  499. X                }
  500. X            }
  501. X        }
  502. X        for(nvynum=0;nvynum<MAXNAVY;nvynum++) if(NMER+NWAR>0){
  503. X            for(i=NXLOC-xoffset-NAVYSEE;i<=NXLOC-xoffset+NAVYSEE;i++) for(j=NYLOC-yoffset-NAVYSEE;j<=NYLOC-yoffset+NAVYSEE;j++){
  504. X                highlight(i,j);
  505. X                see(i,j);
  506. X            }
  507. X        }
  508. X        for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0){
  509. X            for(i=AXLOC-xoffset-ARMYSEE;i<=AXLOC-xoffset+ARMYSEE;i++) for(j=AYLOC-yoffset-ARMYSEE;j<=AYLOC-yoffset+ARMYSEE;j++) {
  510. X                highlight(i,j);
  511. X                see(i,j);
  512. X            }
  513. X        }
  514. X        /*optimal method of highlighting your armies*/
  515. X        if((hilmode==HI_YARM)||(hilmode==HI_MOVE)) {
  516. X            for(armynum=0;armynum<MAXARM;armynum++)
  517. X            if((ASOLD>0)&&((AMOVE>0)||(hilmode==HI_YARM))){
  518. X                standout();
  519. X                see(AXLOC-xoffset,AYLOC-yoffset);
  520. X            }
  521. X            for(nvynum=0;nvynum<MAXNAVY;nvynum++)
  522. X            if((NWAR+NMER>0)&&((NMOVE>0)||(hilmode==HI_YARM))){
  523. X                standout();
  524. X                see(NXLOC-xoffset,NYLOC-yoffset);
  525. X            }
  526. X        }
  527. X    }
  528. X    move(ycurs,2*xcurs);
  529. X}
  530. X
  531. Xvoid
  532. Xnewdisplay()
  533. X{
  534. X    mvaddstr(LINES-4,0,"viewing options:  (d)esignation, (r)ace, (m)ove cost, (p)eople, (D)efense");
  535. X    clrtoeol();
  536. X        mvaddstr(LINES-3,0,"          (f)ood, (c)ontour, (v)egetation, (i)ron, (n)ation mark, (j)ewels");
  537. X    clrtoeol();
  538. X    mvaddstr(LINES-2,0,"highlight option: (o)wners, (a)rmy, (y)our Army, (M)ove left, (x)=none");
  539. X    clrtoeol();
  540. X    standout();
  541. X    mvaddstr(LINES-1,0,"what display?:");
  542. X    clrtoeol();
  543. X    move(LINES-1,16);
  544. X    standend();
  545. X    refresh();
  546. X    redraw=TRUE;
  547. X    switch(getch()) {
  548. X    case 'f':
  549. X        dismode=DI_FOOD;
  550. X        break;
  551. X    case 'v':    /* vegetation map*/
  552. X        dismode=DI_VEGE;
  553. X        break;
  554. X    case 'd':    /* designations map*/
  555. X        dismode=DI_DESI;
  556. X        break;
  557. X    case 'c':    /* contour map of world */
  558. X        dismode=DI_CONT;
  559. X        break;
  560. X    case 'n':    /* nations map*/
  561. X        dismode=DI_NATI;
  562. X        break;
  563. X    case 'r':    /* race map*/
  564. X        dismode=DI_RACE;
  565. X        break;
  566. X    case 'm':    /* move cost map*/
  567. X        dismode=DI_MOVE;
  568. X        break;
  569. X    case 'D':
  570. X        dismode=DI_DEFE;
  571. X        break;
  572. X    case 'p':
  573. X        dismode=DI_PEOP;
  574. X        break;
  575. X    case 'j':
  576. X        dismode=DI_GOLD;
  577. X        break;
  578. X    case 'i':
  579. X        dismode=DI_IRON;
  580. X        break;
  581. X    case 'a':    /* armies hilighted map*/
  582. X        prep(country);
  583. X        hilmode=HI_ARMY;
  584. X        break;
  585. X    case 'o':    /* owners hilighted map*/
  586. X        hilmode=HI_OWN;
  587. X        break;
  588. X    case 'x':    /*no highlighting*/
  589. X        hilmode=HI_NONE;
  590. X        break;
  591. X    case 'y':    /* your armies hilighted map*/
  592. X        prep(country);
  593. X        hilmode=HI_YARM;
  594. X        break;
  595. X    case 'M':    /* your armies with moves left hilighted map*/
  596. X        prep(country);
  597. X        hilmode=HI_MOVE;
  598. X        break;
  599. X    default:
  600. X        beep();
  601. X        redraw=FALSE;
  602. X    }
  603. X    makebottom();
  604. X}
  605. X
  606. X/*see what is in xy as per display mode*/
  607. Xvoid
  608. Xsee(x,y)
  609. X{
  610. X    int armbonus;
  611. X    if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
  612. X    if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
  613. X
  614. X        if((magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==TRUE)
  615. X        &&((dismode==DI_DEFE)||(dismode==DI_GOLD)||(dismode==DI_IRON)
  616. X            ||(dismode==DI_PEOP)||(dismode==DI_FOOD))
  617. X        &&(country!=sct[x+xoffset][y+yoffset].owner)
  618. X        &&(country!=0)) {
  619. X            standout();
  620. X            mvaddch(y,2*x,' ');
  621. X            standend();
  622. X        } else {
  623. X            switch(dismode){
  624. X            case DI_FOOD:    /*food */
  625. X                if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
  626. X                mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
  627. X                else
  628. X                mvprintw(y,2*x,"%d",tofood(sct[x+xoffset][y+yoffset].vegetation,country));
  629. X                break;
  630. X            case DI_VEGE: /*vegetation*/
  631. X                mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
  632. X                break;
  633. X            case DI_DESI: /*designation*/
  634. X                if(sct[x+xoffset][y+yoffset].owner==0){
  635. X                    if(tofood(sct[x+xoffset][y+yoffset].vegetation,sct[x+xoffset][y+yoffset].owner)!=0) mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
  636. X                    else mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
  637. X                }
  638. X                else if((country==0)
  639. X                ||(sct[x+xoffset][y+yoffset].owner==country))
  640. X                mvaddch(y,2*x,sct[x+xoffset][y+yoffset].designation);
  641. X                else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
  642. X                break;
  643. X            case DI_CONT: /*contour*/
  644. X                mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
  645. X                break;
  646. X            case DI_NATI: /*ownership*/
  647. X                if(sct[x+xoffset][y+yoffset].owner==0)
  648. X                    mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
  649. X                else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
  650. X                break;
  651. X            case DI_RACE: /*race*/
  652. X                if(sct[x+xoffset][y+yoffset].owner==0)
  653. X                    mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
  654. X                else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].race);
  655. X                break;
  656. X            case DI_MOVE:    /*movement cost map*/
  657. X                if(movecost[x+xoffset][y+yoffset]>=0) mvprintw(y,2*x,"%d",movecost[x+xoffset][y+yoffset]);
  658. X                else if(sct[x+xoffset][y+yoffset].altitude==WATER)
  659. X                    mvaddch(y,2*x,WATER);
  660. X                else
  661. X                    mvaddch(y,2*x,'X');
  662. X                break;
  663. X            case DI_DEFE:   /*Defence*/
  664. X                if (sct[x+xoffset][y+yoffset].altitude==WATER)
  665. X                    mvaddch(y,2*x,WATER);
  666. X                else if (movecost[x+xoffset][y+yoffset]<0)
  667. X                    mvaddch(y,2*x,'*');
  668. X                else {
  669. X
  670. X                    /*Racial combat bonus due to terrain (the faster you move the better)*/
  671. X                    armbonus=0;
  672. X                    armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
  673. X
  674. X                    if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN) armbonus+=40;
  675. X                    else if(sct[x+xoffset][y+yoffset].altitude==HILL) armbonus+=20;
  676. X
  677. X                    if(sct[x+xoffset][y+yoffset].vegetation==JUNGLE)
  678. X                        armbonus+=30;
  679. X                    else if(sct[x+xoffset][y+yoffset].vegetation==FOREST)
  680. X                        armbonus+=20;
  681. X                    else if(sct[x+xoffset][y+yoffset].vegetation==WOOD)
  682. X                        armbonus+=10;
  683. X
  684. X            if((sct[x+xoffset][y+yoffset].designation==DCASTLE)
  685. X            ||(sct[x+xoffset][y+yoffset].designation==DCITY)
  686. X            ||(sct[x+xoffset][y+yoffset].designation==DCAPITOL))
  687. X                        armbonus+=8*sct[x+xoffset][y+yoffset].fortress;
  688. X
  689. X                    mvprintw(y,2*x,"%d",armbonus/20);
  690. X                }
  691. X                break;
  692. X            case DI_PEOP:   /*People*/
  693. X                if (sct[x+xoffset][y+yoffset].altitude==WATER)
  694. X                    mvaddch(y,2*x,WATER);
  695. X                else if (sct[x+xoffset][y+yoffset].people>=1000)
  696. X                    mvaddch(y,2*x,'+');
  697. X                else if (sct[x+xoffset][y+yoffset].people>=450)
  698. X                    mvaddch(y,2*x,'>');
  699. X                else if (sct[x+xoffset][y+yoffset].people==0)
  700. X                    mvaddch(y,2*x,'0');
  701. X                else
  702. X                    mvprintw(y,2*x,"%d",1+sct[x+xoffset][y+yoffset].people/50);
  703. X                break;
  704. X            case DI_GOLD:  /*Gold*/
  705. X                if (sct[x+xoffset][y+yoffset].altitude==WATER)
  706. X                    mvaddch(y,2*x,WATER);
  707. X                else if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
  708. X                    mvaddch(y,2*x,'X');
  709. X                else if((sct[x+xoffset][y+yoffset].owner!=0)
  710. X                &&(country!=0)
  711. X                &&(sct[x+xoffset][y+yoffset].owner!=country))
  712. X                    mvaddch(y,2*x,'?');
  713. X                else if(sct[x+xoffset][y+yoffset].gold>=10)
  714. X                    mvaddch(y,2*x,'+');
  715. X                else
  716. X                    mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].gold);
  717. X                break;
  718. X            case DI_IRON:  /*Iron*/
  719. X                if (sct[x+xoffset][y+yoffset].altitude==WATER)
  720. X                    mvaddch(y,2*x,WATER);
  721. X                else if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
  722. X                    mvaddch(y,2*x,'X');
  723. X                else if((sct[x+xoffset][y+yoffset].owner!=0)
  724. X                &&(country!=0)
  725. X                &&(sct[x+xoffset][y+yoffset].owner!=country))
  726. X                    mvaddch(y,2*x,'?');
  727. X                else if (sct[x+xoffset][y+yoffset].iron>=10)
  728. X                    mvaddch(y,2*x,'+');
  729. X                else
  730. X                    mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].iron);
  731. X                break;
  732. X            default:
  733. X                break;
  734. X            }
  735. X        }
  736. X    }
  737. X    else mvaddch(y,2*x,' ');
  738. X    standend();
  739. X}
  740. X
  741. X/*highlight what is in xy as per highlight mode*/
  742. Xvoid
  743. Xhighlight(x,y)
  744. X{
  745. X    if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
  746. X    if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
  747. X        switch(hilmode){
  748. X        case HI_OWN: /*ownership*/
  749. X            if(country==0) {
  750. X                if(sct[x+xoffset][y+yoffset].owner>0)
  751. X                    standout();
  752. X            }
  753. X            else if(sct[x+xoffset][y+yoffset].owner==country)
  754. X                standout();
  755. X            break;
  756. X        case HI_ARMY: /*army map*/
  757. X            if(occ[x+xoffset][y+yoffset]!=0) standout();
  758. X            break;
  759. X        default:
  760. X            break;
  761. X        }
  762. X    }
  763. X}
  764. X
  765. X/* check if cursor is out of bounds*/
  766. Xvoid
  767. Xcoffmap()
  768. X{
  769. X    if((xcurs<1)||(ycurs<1)||(xcurs>=SCREEN_X_SIZE)
  770. X    ||((ycurs>=SCREEN_Y_SIZE))||((XREAL)>=MAPX)
  771. X    ||((YREAL)>=MAPY)) offmap();
  772. X
  773. X    /*update map*/
  774. X    if(redraw==TRUE) {
  775. X        clear();
  776. X        makemap(); /* update map*/
  777. X        makebottom();
  778. X        redraw=FALSE;
  779. X    }
  780. X    move(ycurs,2*xcurs);
  781. X    makeside();  /*update side*/
  782. X    move(ycurs,2*xcurs);
  783. X    refresh();
  784. X}
  785. END_OF_display.c
  786. if test 9939 -ne `wc -c <display.c`; then
  787.     echo shar: \"display.c\" unpacked with wrong size!
  788. fi
  789. # end of overwriting check
  790. fi
  791. if test -f newlogin.c -a "${1}" != "-c" ; then 
  792.   echo shar: Will not over-write existing file \"newlogin.c\"
  793. else
  794. echo shar: Extracting \"newlogin.c\" \(28406 characters\)
  795. sed "s/^X//" >newlogin.c <<'END_OF_newlogin.c'
  796. X/*conquer : Copyright (c) 1988 by Ed Barlow.
  797. X *  I spent a long time writing this code & I hope that you respect this.
  798. X *  I give permission to alter the code, but not to copy or redistribute
  799. X *  it without my explicit permission.  If you alter the code,
  800. X *  please document changes and send me a copy, so all can have it.
  801. X *  This code, to the best of my knowledge works well,  but it is my first
  802. X *  'C' program and should be treated as such.  I disclaim any
  803. X *  responsibility for the codes actions (use at your own risk).  I guess
  804. X *  I am saying "Happy gaming", and am trying not to get sued in the process.
  805. X *                                                Ed
  806. X */
  807. X
  808. X/*create a new login for a new player*/
  809. X#include <ctype.h>
  810. X#include "newlogin.h"
  811. X#include "header.h"
  812. X#include "data.h"
  813. X
  814. Xextern FILE *fexe, *fopen();
  815. Xextern short country;
  816. X
  817. Xvoid
  818. Xnewlogin()
  819. X{
  820. X    /* use points to create empire, add if late starter*/
  821. X    int points;
  822. X    char tempc[10];
  823. X    int n;
  824. X    int valid=TRUE;  /*valid==FALSE means continue loop*/
  825. X    int temp;
  826. X    int more=TRUE;    /*0 if add another player*/
  827. X    int loop;
  828. X    long x;
  829. X    char tempo[8];
  830. X    char passwd[8];
  831. X    register i;
  832. X
  833. X    printf("\nPreparing to add player\n");
  834. X    printf("break at any time to abort\n");
  835. X
  836. X    while(more==TRUE) {
  837. X        points=MAXPTS;
  838. X        /*find valid nation number type*/
  839. X        for(i=1;i<MAXNTN;i++)
  840. X            if(ntn[i].active==0) {
  841. X                country=i;
  842. X                break;
  843. X            }
  844. X        printf("first valid nation id is %d\n",country);
  845. X
  846. X        if(i==MAXNTN) {
  847. X            beep();
  848. X            printf("error, cant add new nation\n");
  849. X            return;
  850. X        }
  851. X
  852. X        /* open output for future printing*/
  853. X        sprintf(tempc,"%s%d",exefile,i);
  854. X        if ((fexe=fopen(tempc,"w"))==NULL) {
  855. X            beep();
  856. X            printf("error opening %s\n",tempc);
  857. X            exit(FAIL);
  858. X        }
  859. X
  860. X        ntn[country].active=1;
  861. X
  862. X        valid=FALSE;
  863. X        /*get name*/
  864. X        while(valid==FALSE) {
  865. X            valid=TRUE;
  866. X            printf("\nwhat name would you like your nation to have:");
  867. X            scanf("%s",ntn[country].name);
  868. X
  869. X            if((strlen(ntn[country].name)<=1)
  870. X             ||(strlen(ntn[country].name)>NAMELTH)){
  871. X                printf("\ninvalid name");
  872. X                valid=FALSE;
  873. X            }
  874. X
  875. X            /*check if already used*/
  876. X            if((strcmp(ntn[country].name,"god")==0)
  877. X            ||(strcmp(ntn[country].name,"unowned")==0)){
  878. X                printf("\nname already used");
  879. X                valid=FALSE;
  880. X            }
  881. X
  882. X            for(i=1;i<MAXNTN;i++)
  883. X                if((i!=country)&&(strcmp(ntn[i].name,ntn[country].name)==0)) {
  884. X                    printf("\nname already used");
  885. X                    valid=FALSE;
  886. X                }
  887. X        }
  888. X
  889. X        /*get password*/
  890. X        valid=FALSE;
  891. X        while(valid==FALSE) {
  892. X            printf("\nwhat is your nations password:");
  893. X            scanf("%7s",passwd);
  894. X            if((strlen(passwd)>PASSLTH)||(strlen(passwd)<2)) {
  895. X                beep();
  896. X                printf("\ninvalid password (too short or long)");
  897. X            }
  898. X            else {
  899. X                printf("\nreenter your nations password:");
  900. X                scanf("%7s",ntn[country].passwd);
  901. X            }
  902. X            if(strcmp(passwd,ntn[country].passwd)==0) valid=TRUE;
  903. X        }
  904. X        strncpy(ntn[country].passwd,crypt(passwd,SALT),PASSLTH);
  905. X
  906. X        /*get your name*/
  907. X        valid=FALSE;
  908. X        while(valid==FALSE) {
  909. X            valid=TRUE;
  910. X            printf("\nenter either YOUR name (j_smith) or the name of your nations leader (gandalf...)");
  911. X            printf("\n\t(maximum 10 characters, no spaces):");
  912. X            scanf("%s",tempc);
  913. X            if((strlen(tempc)>=10)||(strlen(tempc)<2)) {
  914. X                beep();
  915. X                printf("\ninvalid name (too short or long)");
  916. X                valid=FALSE;
  917. X            }
  918. X            else strcpy(ntn[country].leader,tempc);
  919. X        }
  920. X
  921. X        valid=FALSE;
  922. X        while(valid==FALSE) {
  923. X            valid=TRUE;
  924. X            printf("\nwhat race would you like to be:");
  925. X            printf("\n\tchoose (d)warf,(e)lf,(o)rc,(h)uman:");
  926. X            scanf("%1s",tempo);
  927. X            switch(tempo[0]) {
  928. X            case 'd':
  929. X                printf("\ndwarf chosen\n");
  930. X                /*MINER POWER INATE TO DWARVES*/
  931. X                printf("you have magical MINING skills\n");
  932. X                ntn[country].powers=MINER;
  933. X                x=MINER;
  934. X                CHGMGK;
  935. X                points -= getclass(DWARF);
  936. X                ntn[country].race=DWARF;
  937. X                ntn[country].tgold=NLDGOLD;    /*1   pts*/
  938. X                ntn[country].tfood=NLDFOOD;     /*0   pts*/
  939. X                ntn[country].jewels=NLDJEWEL;     /*0   pts*/
  940. X                ntn[country].tiron=NLDIRON;     /*0   pts*/
  941. X                ntn[country].tciv= NLDCIVIL;    /*6   pts*/
  942. X                ntn[country].tmil= NLDMILIT;    /*1.5 pts*/
  943. X                ntn[country].repro= NLDREPRO;    /*4   pts*/
  944. X                ntn[country].maxmove= NLDMMOVE;    /*1.5 pts*/
  945. X                ntn[country].aplus= NLDAPLUS;    /*2   pts*/
  946. X                ntn[country].dplus= NLDDPLUS;    /*2   pts*/
  947. X                ntn[country].location=RANDOM;    /*0+  pts*/
  948. X                points-=NLPTDW;
  949. X                break;
  950. X            case 'e':
  951. X                printf("\nelf chosen\n");
  952. X                printf("you have magical cloaking skills\n");
  953. X                ntn[country].powers=THE_VOID;
  954. X                x=THE_VOID;
  955. X                CHGMGK;
  956. X                points -= getclass(ELF);
  957. X                ntn[country].race=ELF;
  958. X                ntn[country].tgold=NLEGOLD;    /*1  pts*/
  959. X                ntn[country].tfood=NLEFOOD;
  960. X                ntn[country].jewels=NLEJEWEL;
  961. X                ntn[country].tiron=NLEIRON;
  962. X                ntn[country].tciv=NLECIVIL;    /*7    pts*/
  963. X                ntn[country].tmil=NLEMILIT;    /*0   pts*/
  964. X                ntn[country].repro=NLEREPRO;    /*3   pts*/
  965. X                ntn[country].maxmove=NLEMMOVE;    /*2   pts*/
  966. X                ntn[country].aplus=NLEAPLUS;    /*1   pts*/
  967. X                ntn[country].dplus=NLEDPLUS;    /*4   pts*/
  968. X                ntn[country].location=FAIR;    /*1   pts*/
  969. X                points-=NLPTEL;    /* VOID COSTS ADDITIONAL PT*/
  970. X                break;
  971. X            case 'o':
  972. X                printf("\norc chosen\n");
  973. X                /*MINOR MONSTER POWER INATE TO ORCS*/
  974. X                printf("your leader is a minor monster (army 0 is very potent)\n");
  975. X                ntn[country].powers=MI_MONST;
  976. X                x=MI_MONST;
  977. X                CHGMGK;
  978. X                points -= getclass(ORC);
  979. X                ntn[country].race=ORC;
  980. X                ntn[country].tgold=NLOGOLD;    /*0   pts*/
  981. X                ntn[country].tfood=NLOFOOD;
  982. X                ntn[country].jewels=NLOJEWEL;
  983. X                ntn[country].tiron=NLOIRON;
  984. X                ntn[country].tciv=NLOCIVIL;    /*4   pts*/
  985. X                ntn[country].tmil=NLOMILIT;    /*2.5 pts*/
  986. X                ntn[country].repro=NLOREPRO;    /*10  pts*/
  987. X                ntn[country].maxmove=NLOMMOVE;    /*1.5 pts*/
  988. X                ntn[country].aplus=NLOAPLUS;    /*0   pts*/
  989. X                ntn[country].dplus=NLODPLUS;    /*0   pts*/
  990. X                ntn[country].location=RANDOM;    /*0   pts*/
  991. X                points-=NLPTOR;
  992. X                break;
  993. X            case 'h':
  994. X                printf("\nhuman chosen\n");
  995. X                ntn[country].race=HUMAN;
  996. X                /*WARRIOR POWER INATE TO HUMANS*/
  997. X                printf("you have magical WARRIOR skills\n");
  998. X                ntn[country].powers=WARRIOR;
  999. X                x=WARRIOR;
  1000. X                CHGMGK;
  1001. X                points -= getclass(HUMAN);
  1002. X                ntn[country].tgold=NLHGOLD;    /*0  pts*/
  1003. X                ntn[country].tfood=NLHFOOD;    /*0   pts*/
  1004. X                ntn[country].jewels=NLHJEWEL;    /*0   pts*/
  1005. X                ntn[country].tiron=NLHIRON;    /*0   pts*/
  1006. X                ntn[country].tciv=NLHCIVIL;    /*6   pts*/
  1007. X                ntn[country].tmil=NLHMILIT;    /*1   pts*/
  1008. X                ntn[country].repro=NLHREPRO;    /*5   pts*/
  1009. X                ntn[country].maxmove=NLHMMOVE;    /*2.5 pts*/
  1010. X                ntn[country].aplus=NLHAPLUS;    /*1   pts*/
  1011. X                ntn[country].dplus=NLHDPLUS;    /*1   pts*/
  1012. X                ntn[country].location=RANDOM;    /*0   pts*/
  1013. X                points-=NLPTHU;
  1014. X                break;
  1015. X            default:
  1016. X                printf("\ninvalid race\n ");
  1017. X                valid=0;
  1018. X            }
  1019. X        }
  1020. X
  1021. X        ntn[country].mark = toupper(*ntn[country].name);
  1022. X        printf("\ntesting first letter of name (%c) for nation mark...",ntn[country].mark);
  1023. X        valid=TRUE;
  1024. X        while(valid==TRUE) {
  1025. X            valid=FALSE;
  1026. X            if((isprint(ntn[country].mark)==0)
  1027. X            ||(isspace(ntn[country].mark)!=0)) {
  1028. X                printf("\n%c is not a graphical character",ntn[country].mark);
  1029. X                valid=TRUE;
  1030. X            }
  1031. X            if(valid==FALSE) for(i=0;i<=3;i++)
  1032. X            if(ntn[country].mark==(*(ele+i))) {
  1033. X                printf("\n%c is an altitude character",ntn[country].mark);
  1034. X                valid=TRUE;
  1035. X            }
  1036. X            if(valid==FALSE) for(i=0;i<=11;i++)
  1037. X            if(ntn[country].mark==(*(veg+i))) {
  1038. X                printf("\n%c is a vegetation character", ntn[country].mark );
  1039. X                valid=TRUE;
  1040. X            }
  1041. X            if(valid==FALSE) for(i=1;i<country;i++)
  1042. X            if(ntn[i].mark==ntn[country].mark) {
  1043. X                printf("\n%c is an already used character",ntn[country].mark);
  1044. X                valid=TRUE;
  1045. X            }
  1046. X            if(valid==FALSE) if(ntn[country].mark=='*') {
  1047. X                printf("\n'*' is invalid character");
  1048. X                valid=TRUE;
  1049. X            }
  1050. X            if(valid==TRUE){
  1051. X                printf("\nplease reenter new national mark for maps:");
  1052. X                printf("\n (this can be any uppercase character)");
  1053. X                scanf("%1s",tempc);
  1054. X                ntn[country].mark=(*tempc);
  1055. X                /* if lower case letter, make it upper */
  1056. X                if( islower(ntn[country].mark)!=0)
  1057. X                    ntn[country].mark=
  1058. X                        toupper(ntn[country].mark);
  1059. X            }
  1060. X            else printf("\nvalid...");
  1061. X        }
  1062. X
  1063. X        printf("mark currently is %c\n",ntn[country].mark);
  1064. X
  1065. X        while(points>0) {
  1066. X            printf("\n\nwhat would you like to buy with your remaining %d points\n\n",points);
  1067. X            printf("\t1. population (%d/pt):\t\tnow have %ld civilians\n",NLPOP,ntn[country].tciv);
  1068. X            printf("\t2. more gold ($%d/pt):\t\tnow have %ld gold pieces\n",NLGOLD,ntn[country].tgold);
  1069. X            printf("\t3. better location (%d pt):\t\tlocation is now is %c\n",NLLOCCOST,ntn[country].location);
  1070. X            printf("\t4. more soldiers (%d/pt):\t\tnow have %ld soldiers\n",NLSOLD,ntn[country].tmil);
  1071. X            printf("\t5. better attack (%d%%/pt):\t\tnow is +%d\n ",NLATTACK,ntn[country].aplus);
  1072. X            printf("\t6. better defence (%d%%/pt):\t\tnow is +%d\n",NLDEFENCE,ntn[country].dplus);
  1073. X            printf("\t7. higher reproduction (+%d%%/%d pt):\trate is now %d%%\n",NLREPRO,NLREPCOST,ntn[country].repro);
  1074. X            printf("\t8. higher movement (%d/pt): \t\tnow move %d sectors\n",NLMOVE,ntn[country].maxmove);
  1075. X            printf("\t9. double raw recourses (%d pts): \tfood now %ld\n",NLDBLCOST*ntn[country].tfood/NLHFOOD,ntn[country].tfood);
  1076. X            printf("\t                                \tjewels now %ld\n",ntn[country].jewels);
  1077. X            printf("\t                                \tiron now %ld\n",ntn[country].tiron);
  1078. X            printf("\t10. additional random magic power (%d pts)\n",NLMAGIC);
  1079. X
  1080. X
  1081. X            printf("\nWhat option to buy:");
  1082. X            if(scanf("%d",&n)==1) switch(n) {
  1083. X
  1084. X            case 1:
  1085. X                printf("additional population costs 1 pt per %d\n",NLPOP);
  1086. X                printf("how many points to spend on population:");
  1087. X                scanf("%d",&temp);
  1088. X                putchar('\n');
  1089. X                if(points >= temp) {
  1090. X                    points -= temp;
  1091. X                    ntn[country].tciv+=temp*NLPOP;
  1092. X                }
  1093. X                else printf("You dont have enough points left");
  1094. X                break;
  1095. X            case 2:
  1096. X                printf("you now have $%ld\n",ntn[country].tgold);
  1097. X                printf("and can buy gold at $%d per point\n",NLGOLD);
  1098. X                printf("how many points to spend on added gold:");
  1099. X                scanf("%d",&temp);
  1100. X                putchar('\n');
  1101. X                if(points>=temp)
  1102. X                {
  1103. X                    points-=temp;
  1104. X                    ntn[country].tgold+=temp*NLGOLD;
  1105. X                }
  1106. X                else printf("You dont have enough points left");
  1107. X                break;
  1108. X            case 3:
  1109. X                printf("you now are in %c location\n",ntn[country].location);
  1110. X                printf("  R=random, F=fair, G=good\n");
  1111. X                if(ntn[country].location==RANDOM){
  1112. X                    printf("%dpts for (g)ood location or 1pts for (f)air\n",2*NLLOCCOST);
  1113. X                }
  1114. X                if(ntn[country].location==FAIR){
  1115. X                    printf("%dpts for (g)ood location\n",NLLOCCOST);
  1116. X                }
  1117. X                if(ntn[country].location==GREAT) return;
  1118. X
  1119. X                printf("what type of location do you wish:");
  1120. X                scanf("%1s",tempo);
  1121. X                switch(tempo[0]) {
  1122. X                case 'g':
  1123. X                case GREAT:
  1124. X                    if(ntn[country].location==FAIR){
  1125. X                        printf("%dpts for (g)ood location\n",NLLOCCOST);
  1126. X                        if(points>=NLLOCCOST) {
  1127. X                            points -=NLLOCCOST;
  1128. X                            ntn[country].location=GREAT;
  1129. X                        }
  1130. X                        else printf("You dont have enough points left");
  1131. X                    }
  1132. X                    else {
  1133. X                        if(points>=2*NLLOCCOST) {
  1134. X                            points -= 2*NLLOCCOST;
  1135. X                            ntn[country].location=GREAT;
  1136. X                        }
  1137. X                        else printf("You dont have enough points left");
  1138. X                    }
  1139. X                    break;
  1140. X                case 'f':
  1141. X                case FAIR:
  1142. X                    if(ntn[country].location==RANDOM){
  1143. X                        if(points>=NLLOCCOST) {
  1144. X                            points -=NLLOCCOST;
  1145. X                            ntn[country].location=FAIR;
  1146. X                        }
  1147. X                        else printf("You dont have enough points left");
  1148. X                    }
  1149. X                    else printf("\nlocation unchanged\n");
  1150. X                    break;
  1151. X                default:
  1152. X                    printf("\nlocation unchanged\n");
  1153. X                }
  1154. X                putchar('\n');
  1155. X                break;
  1156. X            case 4:
  1157. X                printf("you start with %ld soldiers\n",ntn[country].tmil);
  1158. X                printf("additional military costs 1 / %d\n",NLSOLD);
  1159. X                printf("how many points to spend?");
  1160. X                scanf("%d",&temp);
  1161. X                putchar('\n');
  1162. X                if(points >= temp) {
  1163. X                    points -= temp;
  1164. X                    ntn[country].tmil+=temp*NLSOLD;
  1165. X                }
  1166. X                else printf("You dont have enough points left");
  1167. X                break;
  1168. X            case 5:
  1169. X                if(magic(country,VAMPIRE)==1) {
  1170. X                printf("you have vampire power and cant add to combat bonus\n");
  1171. X                break;
  1172. X                }
  1173. X                printf("now have %d percent attack bonus\n",ntn[country].aplus);
  1174. X                printf("an additional %d percent per point\n",NLATTACK);
  1175. X                printf("how many points do you wish to spend?");
  1176. X                scanf("%d",&temp);
  1177. X                putchar('\n');
  1178. X                if(points >= temp) {
  1179. X                    points -= temp;
  1180. X                    ntn[country].aplus+=temp*NLATTACK;
  1181. X                }
  1182. X                else printf("You dont have enough points left");
  1183. X                break;
  1184. X            case 6:
  1185. X                if(magic(country,VAMPIRE)==1) {
  1186. X                printf("you have vampire power and cant add to combat bonus\n");
  1187. X                break;
  1188. X                }
  1189. X                printf("now have %d percent defence bonus\n",ntn[country].dplus);
  1190. X                printf("an additional %d percent per point\n",NLDEFENCE);
  1191. X                printf("how many points do you wish to spend?");
  1192. X                scanf("%d",&temp);
  1193. X                putchar('\n');
  1194. X                if(points >= temp) {
  1195. X                    points -= temp;
  1196. X                    ntn[country].dplus+=temp*NLDEFENCE;
  1197. X                }
  1198. X                else printf("You dont have enough points left");
  1199. X                break;
  1200. X            case 7:
  1201. X                printf("repro rate costs %d points per %d percent\n",NLREPCOST,NLREPRO);
  1202. X                printf("you now have %d percent\n",ntn[country].repro);
  1203. X                if((ntn[country].race!=ORC)
  1204. X                &&(ntn[country].repro>=10)){
  1205. X                    printf("you have the maximum rate");
  1206. X                    break;
  1207. X                }
  1208. X                else if(ntn[country].repro>=15){
  1209. X                    printf("you have the maximum rate");
  1210. X                    break;
  1211. X                }
  1212. X                printf("how many percentage points to add?:");
  1213. X                scanf("%d",&temp);
  1214. X                putchar('\n');
  1215. X                if(points >= (temp*NLREPCOST)) {
  1216. X                    if((ntn[country].race!=ORC)
  1217. X                    &&(ntn[country].repro+NLREPRO*temp>10)){
  1218. X                    printf("that exceeds the 10%% limit");
  1219. X                    }
  1220. X                    else if((ntn[country].race==ORC)
  1221. X                    &&(ntn[country].repro>15)){
  1222. X                    printf("that exceeds the 15%% limit");
  1223. X                    }
  1224. X                    else {
  1225. X                    points -= temp*NLREPCOST;
  1226. X                    ntn[country].repro+=NLREPRO*temp;
  1227. X                    }
  1228. X                }
  1229. X                else printf("You dont have enough points left");
  1230. X                break;
  1231. X            case 8:
  1232. X                printf("additional movement costs 1 per +%d sct/turn\n",NLMOVE);
  1233. X                printf("you start with a rate of %d\n",ntn[country].maxmove);
  1234. X                printf("you now have a rate of %d\n",ntn[country].maxmove+NLMOVE);
  1235. X                putchar('\n');
  1236. X                if(points >= 1) {
  1237. X                    points -= 1;
  1238. X                    ntn[country].maxmove+=NLMOVE;
  1239. X                }
  1240. X                else printf("You dont have enough points left");
  1241. X                break;
  1242. X            case 9:
  1243. X                printf("doubling raw materials\n");
  1244. X                if((ntn[country].tfood<800000)
  1245. X                &&(points >=NLDBLCOST*ntn[country].tfood/NLHFOOD)) {
  1246. X                    points-=NLDBLCOST*ntn[country].tfood/NLHFOOD;
  1247. X                    ntn[country].tfood*=2;
  1248. X                    ntn[country].jewels*=2;
  1249. X                    ntn[country].tiron*=2;
  1250. X                }
  1251. X                else printf("sorry\n");
  1252. X                break;
  1253. X            case 10:
  1254. X                printf("choosing basic magic at %d point cost\n",NLMAGIC);
  1255. X                printf("log in and read the magic screen to be informed of your powers\n");
  1256. X                if(points >0) {
  1257. X                    points-=NLMAGIC;
  1258. X                    loop=0;
  1259. X                    while(loop==0) if((x=getmagic(rand()%M_MGK+M_MIL))!=0){
  1260. X                        CHGMGK;
  1261. X                        loop=1;
  1262. X                    }
  1263. X                }
  1264. X                else printf("sorry not enough points\n");
  1265. X                break;
  1266. X            default:
  1267. X                printf("invalid option - hit return");
  1268. X                scanf("%*s");
  1269. X            }
  1270. X        }
  1271. X
  1272. X        ntn[country].powers=0;;
  1273. X        printnat();
  1274. X        printf("\nhit 'y' if OK?");
  1275. X        getchar();
  1276. X        if(getchar()!='y'){
  1277. X            ntn[country].active=0;
  1278. X            getchar();
  1279. X            printf("\n OK, nation deleted\n");
  1280. X            printf("\nhit return to add another nation");
  1281. X            printf("\nhit any other key to continue?");
  1282. X            if(getchar()=='\n') more=TRUE;
  1283. X            else more=FALSE;
  1284. X            putchar('\n');
  1285. X        }
  1286. X        else {
  1287. X            place();
  1288. X            getchar();
  1289. X            printf("\nNation is now added to world");
  1290. X            printf("\nhit return to add another nation");
  1291. X            printf("\nhit any other key to continue?");
  1292. X            if(getchar()=='\n') more=TRUE;
  1293. X            else more=FALSE;
  1294. X            putchar('\n');
  1295. X        }
  1296. X        fclose(fexe);
  1297. X    }
  1298. X    writedata();
  1299. X}
  1300. X
  1301. Xvoid
  1302. Xprintnat()
  1303. X{
  1304. X    int i;
  1305. X    i=country;
  1306. X    printf("about to print stats for nation %d\n\n",i);
  1307. X    printf("name is .........%s\n",ntn[i].name);
  1308. X    printf("leader is .......%s\n",ntn[i].leader);
  1309. X    printf("total sctrs .....%d\n",ntn[i].tsctrs);
  1310. X    printf("class is ........%s\n",*(Class+ntn[i].class));
  1311. X    printf("mark is .........%c\n",ntn[i].mark);
  1312. X    printf("race is .........%c\n",ntn[i].race);
  1313. X    printf("attack plus is ..+%d\n",ntn[i].aplus);
  1314. X    printf("defence plus is .+%d\n",ntn[i].dplus);
  1315. X    printf("gold is .........%ld\n",ntn[i].tgold);
  1316. X    printf("maxmove is ......%d sctrs\n",ntn[i].maxmove);
  1317. X    printf("jewels is .......%ld\n",ntn[i].jewels);
  1318. X    printf("# military ......%ld\n",ntn[i].tmil);
  1319. X    printf("# civilians .....%ld\n",ntn[i].tciv);
  1320. X    printf("repro is ........%d percent\n",ntn[i].repro);
  1321. X    printf("total iron ......%ld\n",ntn[i].tiron);
  1322. X    printf("total food ......%ld\n",ntn[i].tfood);
  1323. X    printf("total ships .....%d\n",ntn[i].tships);
  1324. X}
  1325. X
  1326. X/*PLACE NATION*/
  1327. Xvoid
  1328. Xplace()
  1329. X{
  1330. X    int placed=0;
  1331. X    int t;
  1332. X    int temp;
  1333. X    int n; /*count vbl for inf loop*/
  1334. X    short armynum=0;
  1335. X    register i,j,x,y;
  1336. X
  1337. X    n=0;
  1338. X    switch(ntn[country].location) {
  1339. X    case OOPS:
  1340. X        while ((placed == 0)&&(n++<2000)){
  1341. X            if(ntn[country].active==1){
  1342. X                x = (rand()%(MAPX-8))+4;
  1343. X                y = (rand()%(MAPY-8))+4;
  1344. X            }
  1345. X            else {
  1346. X                x = (rand()%(MAPX-2))+1;
  1347. X                y = (rand()%(MAPY-2))+1;
  1348. X            }
  1349. X            if(is_habitable(x,y)) placed=1;
  1350. X
  1351. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1352. X                if(sct[i][j].owner!=0) placed=0;
  1353. X            temp=0;
  1354. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1355. X                if(sct[i][j].altitude==WATER) temp++;
  1356. X            if(temp>=7) placed=0;
  1357. X            if(tofood(sct[x][y].vegetation,country)<DESFOOD) placed=0;
  1358. X        }
  1359. X        break;
  1360. X    case RANDOM:
  1361. X        while ((placed == 0)&&(n++<2000)){
  1362. X            if(ntn[country].active==1){
  1363. X#if (MAPX>12)
  1364. X                x = rand()%(MAPX-12)+6;
  1365. X                y = rand()%(MAPY-12)+6;
  1366. X#else
  1367. X                x = rand()%(MAPX-8)+4;
  1368. X                y = rand()%(MAPY-8)+4;
  1369. X#endif
  1370. X                if(is_habitable(x,y)) placed=1;
  1371. X                /*important that no countries near*/
  1372. X                for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++)
  1373. X                    if((sct[i][j].owner<MAXNTN)
  1374. X                    &&(sct[i][j].owner!=0)) placed=0;
  1375. X            }
  1376. X            else {
  1377. X                x = (rand()%(MAPX-6))+3;
  1378. X                y = (rand()%(MAPY-6))+3;
  1379. X                if(is_habitable(x,y)) placed=1;
  1380. X                /*important that no countries near*/
  1381. X                for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++)
  1382. X                    if((sct[i][j].owner<MAXNTN)
  1383. X                    &&(sct[i][j].owner!=0)) placed=0;
  1384. X            }
  1385. X            temp=0;
  1386. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1387. X                if(sct[i][j].altitude==WATER) temp++;
  1388. X            if(temp>=7) placed=0;
  1389. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1390. X                if(sct[i][j].owner!=0) placed=0;
  1391. X            if(tofood(sct[x][y].vegetation,country)<DESFOOD) placed=0;
  1392. X        }
  1393. X        if (placed==1) for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1394. X            if(sct[i][j].altitude!=WATER) sct[i][j].vegetation=GOOD;
  1395. X        break;
  1396. X    case FAIR:
  1397. X        while ((placed == 0)&&(n++<2000)) {
  1398. X            if(ntn[country].active==1){
  1399. X#if (MAPX>24)
  1400. X                x = rand()%(MAPX-24)+12;
  1401. X                y = rand()%(MAPY-24)+12;
  1402. X#else
  1403. X                x = rand()%(MAPX-14)+7;
  1404. X                y = rand()%(MAPY-14)+7;
  1405. X#endif
  1406. X            }
  1407. X            else {
  1408. X                x = rand()%(MAPX-10)+5;
  1409. X                y = rand()%(MAPY-10)+5;
  1410. X            }
  1411. X
  1412. X            if(is_habitable(x,y)) placed=1;
  1413. X
  1414. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1415. X                if(sct[i][j].owner!=0) placed=0;
  1416. X
  1417. X            if(tofood(sct[x][y].vegetation,country)>=DESFOOD){
  1418. X#if(PWATER>50)
  1419. X                temp=0;
  1420. X                for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1421. X                    if(sct[i][j].altitude==WATER) temp++;
  1422. X                if(temp>=7) placed=0;
  1423. X
  1424. X                /*important that no countries near*/
  1425. X                for(i=x-3;i<=x+3;i++) for(j=y-3;j<=y+3;j++){
  1426. X                if((sct[i][j].owner<MAXNTN)
  1427. X                    &&(sct[i][j].owner!=0)) placed=0;
  1428. X                }
  1429. X#else
  1430. X                temp=0;
  1431. X                for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1432. X                    if(sct[i][j].altitude==WATER) temp++;
  1433. X                if(temp>=5) placed=0;
  1434. X
  1435. X                /*important that no countries near*/
  1436. X                for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++){
  1437. X                if((sct[i][j].owner<MAXNTN)
  1438. X                    &&(sct[i][j].owner!=0)) placed=0;
  1439. X                }
  1440. X#endif
  1441. X            }
  1442. X            else placed=0;
  1443. X        }
  1444. X        if (placed==1) for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1445. X            if(sct[i][j].altitude!=WATER) sct[i][j].vegetation=GOOD;
  1446. X        break;
  1447. X    case GREAT:
  1448. X        placed = 0;
  1449. X        while ((placed == 0) && (n++<2000)){
  1450. X            if(ntn[country].active==1){
  1451. X#if (MAPX>40)
  1452. X                x = rand()%(MAPX-40)+20;
  1453. X                y = rand()%(MAPY-40)+20;
  1454. X#else
  1455. X                x = rand()%(MAPX-18)+9;
  1456. X                y = rand()%(MAPY-18)+9;
  1457. X#endif
  1458. X
  1459. X                if(is_habitable(x,y)) placed=1;
  1460. X                /*important that no countries near*/
  1461. X                for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++){
  1462. X                if((sct[i][j].owner<MAXNTN)
  1463. X                    &&(sct[i][j].owner!=0)) placed=0;
  1464. X                }
  1465. X            }
  1466. X            else {
  1467. X#if (MAPX>24)
  1468. X                x = rand()%(MAPX-24)+12;
  1469. X                y = rand()%(MAPY-24)+12;
  1470. X#else
  1471. X                x = rand()%(MAPX-12)+6;
  1472. X                y = rand()%(MAPY-12)+6;
  1473. X#endif
  1474. X                if(is_habitable(x,y)) placed=1;
  1475. X                /*important that no countries near*/
  1476. X                for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++){
  1477. X                if((sct[i][j].owner<MAXNTN)
  1478. X                    &&(sct[i][j].owner!=0)) placed=0;
  1479. X                }
  1480. X            }
  1481. X
  1482. X            for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
  1483. X                if(sct[i][j].owner!=0) placed=0;
  1484. X
  1485. X            if(tofood(sct[x][y].vegetation,country)>=DESFOOD) {
  1486. X                temp=0;
  1487. X                /*if any water within 2 sectors placed = 0*/
  1488. X                for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++)
  1489. X                    if(tofood(sct[x][y].vegetation,country)<=0)
  1490. X                        temp++;
  1491. X#if(PWATER>50)
  1492. X                if(temp>=18) placed=0;
  1493. X#else
  1494. X                if(temp>=15) placed=0;
  1495. X#endif
  1496. X
  1497. X                if (placed==1) switch(ntn[country].race) {
  1498. X                case DWARF:
  1499. X                    sct[x][y].altitude=MOUNTAIN;
  1500. X                    for(i=x-1;i<=x+1;i++)
  1501. X                    for(j=y-1;j<=y+1;j++)
  1502. X                    if((i!=x)&&(j!=y)
  1503. X                    &&(sct[i][j].altitude!=WATER)){
  1504. X                        if (rand()%3==0) {
  1505. X                        sct[i][j].altitude=MOUNTAIN;
  1506. X                        sct[i][j].gold=rand()%6;
  1507. X                        sct[i][j].iron=rand()%6;
  1508. X                        }
  1509. X                        else {
  1510. X                        sct[i][j].altitude=HILL;
  1511. X                        sct[i][j].iron=rand()%4;
  1512. X                        sct[i][j].gold=rand()%4;
  1513. X                        }
  1514. X                    }
  1515. X                    break;
  1516. X                case ELF:
  1517. X                    sct[x][y].vegetation = FOREST;
  1518. X                    for(i=x-1;i<=x+1;i++)
  1519. X                    for(j=y-1;j<=y+1;j++)
  1520. X                    if((i!=x)&&(j!=y)
  1521. X                    &&(sct[i][j].altitude!=WATER)) {
  1522. X                        if (rand()%3==0)
  1523. X                        sct[i][j].vegetation=FOREST;
  1524. X                        else sct[i][j].vegetation=WOOD;
  1525. X
  1526. X                        if (rand()%2==0)
  1527. X                            sct[i][j].gold=rand()%8;
  1528. X                        else sct[i][j].gold=rand()%4;
  1529. X                    }
  1530. X                    break;
  1531. X                case ORC:
  1532. X                    sct[x][y].altitude=MOUNTAIN;
  1533. X                    for(i=x-1;i<=x+1;i++)
  1534. X                    for(j=y-1;j<=y+1;j++)
  1535. X                    if((i!=x)&&(j!=y)
  1536. X                    &&(sct[i][j].altitude!=WATER)) {
  1537. X                        if (rand()%3==0) {
  1538. X                        sct[i][j].altitude=MOUNTAIN;
  1539. X                        }
  1540. X                        else {
  1541. X                        sct[i][j].altitude=HILL;
  1542. X                        }
  1543. X                        if (rand()%2==0){
  1544. X                            sct[i][j].iron=rand()%8;
  1545. X                            sct[i][j].gold=rand()%8;
  1546. X                        }
  1547. X                        else {
  1548. X                            sct[i][j].iron=rand()%4;
  1549. X                            sct[i][j].gold=rand()%4;
  1550. X                        }
  1551. X                    }
  1552. X                    break;
  1553. X                case HUMAN:
  1554. X                    sct[x][y].altitude = CLEAR;
  1555. X                    for(i=x-1;i<=x+1;i++)
  1556. X                    for(j=y-1;j<=y+1;j++)
  1557. X                    if((i!=x)&&(j!=y)
  1558. X                    &&(sct[i][j].altitude!=WATER)) {
  1559. X                        if (rand()%2==0)
  1560. X                        sct[x][y].altitude = CLEAR;
  1561. X
  1562. X                        if (rand()%2==0)
  1563. X                        sct[i][j].vegetation=WOOD;
  1564. X                        else
  1565. X                        sct[i][j].vegetation=GOOD;
  1566. X
  1567. X                        if (rand()%2==0)
  1568. X                        sct[i][j].gold=rand()%7+1;
  1569. X                        else
  1570. X                        sct[i][j].iron=rand()%7+1;
  1571. X                    }
  1572. X                    break;
  1573. X                }
  1574. X            }
  1575. X            else placed=0;
  1576. X        }
  1577. X    }
  1578. X
  1579. X    /*done with one try*/
  1580. X    if(placed==1) {
  1581. X        ntn[country].capx = x;
  1582. X        ntn[country].capy = y;
  1583. X        sct[x][y].designation=DCAPITOL;
  1584. X        sct[x][y].owner=country;
  1585. X        sct[x][y].people=ntn[country].tciv;
  1586. X        sct[x][y].fortress=5;
  1587. X
  1588. X        /* put all military into armies of 100 */
  1589. X        armynum=0;
  1590. X        temp= (int) ntn[country].tmil;
  1591. X        ASOLD= (int) ntn[country].tmil/3;
  1592. X        ATYPE=A_INFANTRY;
  1593. X        temp-=ASOLD;
  1594. X        ASTAT=GARRISON;
  1595. X        AMOVE=0;
  1596. X        AXLOC=ntn[country].capx;
  1597. X        AYLOC=ntn[country].capy;
  1598. X        armynum++;
  1599. X        while ((armynum < MAXARM-1)&&(temp>0)) {
  1600. X            if(temp>100){
  1601. X                ASOLD=100;
  1602. X                ATYPE=A_INFANTRY;
  1603. X                temp-=100;
  1604. X            }
  1605. X            else {
  1606. X                ASOLD=temp;
  1607. X                ATYPE=A_INFANTRY;
  1608. X                temp=0;
  1609. X            }
  1610. X            AXLOC=ntn[country].capx;
  1611. X            AYLOC=ntn[country].capy;
  1612. X            ASTAT=DEFEND;
  1613. X            AMOVE=ntn[country].maxmove;
  1614. X            armynum++;
  1615. X        }
  1616. X        if(temp>0) {
  1617. X            armynum=0;
  1618. X            ASOLD+=temp;
  1619. X            ATYPE=A_INFANTRY;
  1620. X        }
  1621. X
  1622. X        /* give you some terain to start with: pc nations get more*/
  1623. X        if ((ntn[country].active>=2)&&(ntn[country].location==GREAT))
  1624. X            t=1;
  1625. X        else if (ntn[country].active>=2) t=0;
  1626. X        else if (ntn[country].location==OOPS) t=0;
  1627. X        else if (ntn[country].location==RANDOM) t=0;
  1628. X        else if (ntn[country].location==FAIR) t=1;
  1629. X        else if (ntn[country].location==GREAT) t=2;
  1630. X        else printf("error");
  1631. X
  1632. X        for(i=x-t;i<=x+t;i++) for(j=y-t;j<=y+t;j++)
  1633. X            if((tofood(sct[i][j].vegetation,country)>=DESFOOD)
  1634. X            &&(sct[i][j].owner==0)
  1635. X            &&(sct[i][j].people==0)) {
  1636. X                sct[i][j].owner=country;
  1637. X                sct[i][j].designation=DFARM;
  1638. X            }
  1639. X    }
  1640. X    else {
  1641. X        if(ntn[country].location==OOPS) printf("ERROR\n");
  1642. X        else if(ntn[country].location==RANDOM) {
  1643. X            printf("RANDOM PLACE FAILED, TRYING TO PLACE AGAIN\n");
  1644. X            ntn[country].location=OOPS;
  1645. X            place();
  1646. X        }
  1647. X        else if(ntn[country].location==FAIR) {
  1648. X            printf("FAIR PLACE FAILED, TRYING AGAIN - adding %d people to nation\n",NLPOP);
  1649. X            /*give back one point -> NLPOP people*/
  1650. X            ntn[country].tciv+=NLPOP;
  1651. X            ntn[country].location=RANDOM;
  1652. X            place();
  1653. X        }
  1654. X        else if(ntn[country].location==GREAT) {
  1655. X            printf("GOOD PLACE FAILED, TRYING AGAIN - adding %d people to nation\n",NLPOP);
  1656. X            /*give back one point -> NLPOP people*/
  1657. X            ntn[country].tciv+=NLPOP;
  1658. X            ntn[country].location=FAIR;
  1659. X            place();
  1660. X        }
  1661. X    }
  1662. X}
  1663. X
  1664. X/*get class routine*/
  1665. X/* return the number of points needed */
  1666. Xint
  1667. Xgetclass(race)
  1668. X{
  1669. X    short check=FALSE,i;
  1670. X    int x;
  1671. X    short tmp;
  1672. X    while(check==FALSE){
  1673. X        printf("what type of nation would you like to be\n");
  1674. X        if(race!=ORC){
  1675. X            printf("1. king      (Humans, Dwarves, and Elves)\n");
  1676. X            printf("2. emperor   (Humans, Dwarves, and Elves)\n");
  1677. X            printf("3. wizard    (Humans, Dwarves, and Elves)........Cost = 2 Points\n");
  1678. X            printf("\tA wizard will have the magical SUMMON power automatically. \n");
  1679. X        }
  1680. X        if(race==HUMAN){
  1681. X            printf("4. theocracy (Humans Only).......................Cost = 2 Points\n");
  1682. X            printf("\tA theocracy will have the magical HEALER power automatically. \n");
  1683. X        }
  1684. X        if((race==HUMAN)||(race==ORC)){
  1685. X            printf("5. pirate    (Humans & Orcs Only)................Cost = 1 Point\n");
  1686. X            printf("\tPirates will have the magical SAILOR power automatically\n");
  1687. X        }
  1688. X        if((race==ELF)||(race==DWARF)){
  1689. X            printf("6. trader    (Elves & Dwarves Only)..............Cost = 2 Points\n");
  1690. X            printf("\tTraders have URBAN power automatically\n");
  1691. X        }
  1692. X        if((race==HUMAN)||(race==ORC)){
  1693. X            if(magic(country,WARRIOR)==TRUE)
  1694. X            printf("7. warlord   (Humans & Orcs Only)................Cost = 2 Point\n");
  1695. X            else printf("7. warlord   (Humans & Orcs Only)................Cost = 3 Point\n");
  1696. X            printf("\tWarlords have magical WARLORD power automatically\n");
  1697. X        }
  1698. X        if(race==ORC){
  1699. X            printf("8. demon     (Orcs Only).........................Cost = 2 Points\n");
  1700. X            printf("\tA demon will have the magical DESTROYER power automatically\n");
  1701. X            printf("9. dragon    (Orcs Only).........................Cost = 2 Points\n");
  1702. X            printf("\tA dragon will have the magical MAJOR MONSTER power automatically\n");
  1703. X            printf("10. shadow    (Orcs Only)........................Cost = 1 Point\n");
  1704. X            printf("\tA shadow will have the magical VOID power automatically\n");
  1705. X        }
  1706. X        printf("\tinput:");
  1707. X        scanf("%hd",&tmp);
  1708. X        if((tmp>=1)&&(tmp<=10)) {
  1709. X            if((race==HUMAN)&&((tmp<6)||(tmp==7))) check=TRUE;
  1710. X            else if((race==DWARF)&&((tmp<=3)||(tmp==6))) check=TRUE;
  1711. X            else if((race==ELF)&&((tmp==6)||(tmp<=3))) check=TRUE;
  1712. X            else if((race==ORC)&&((tmp==5)||(tmp>6))) check=TRUE;
  1713. X            else printf("bad input \n\n\n");
  1714. X        } else {
  1715. X            printf("\tinvalid input\n\n\n");
  1716. X            getchar();
  1717. X        }
  1718. X    }
  1719. X    ntn[country].class=tmp;
  1720. X    switch(tmp){
  1721. X    case 3:
  1722. X        printf("\nwizards have the magical SUMMON power automatically");
  1723. X        ntn[country].powers|=SUMMON;
  1724. X        x=SUMMON;
  1725. X        CHGMGK;
  1726. X        return(2);
  1727. X    case 4:
  1728. X        printf("\ntheocracies have magical HEALER power automatically. ");
  1729. X        ntn[country].powers|=HEALER;
  1730. X        x=HEALER;
  1731. X        CHGMGK;
  1732. X        return(2);
  1733. X    case 5:
  1734. X        printf("\tPirates have the magical SAILOR power automatically\n");
  1735. X        ntn[country].powers|=SAILOR;
  1736. X        x=SAILOR;
  1737. X        CHGMGK;
  1738. X        return(1);
  1739. X    case 6:
  1740. X        printf("\tTraders have URBAN power automatically\n");
  1741. X        ntn[country].powers|=URBAN;
  1742. X        x=URBAN;
  1743. X        CHGMGK;
  1744. X        return(2);
  1745. X    case 7:
  1746. X        i=0;
  1747. X        if(magic(country,WARRIOR)!=TRUE){
  1748. X            ntn[country].powers|=WARRIOR;
  1749. X            x=WARRIOR;
  1750. X            CHGMGK;
  1751. X            i++;
  1752. X        }
  1753. X        if(magic(country,CAPTAIN)!=TRUE){
  1754. X            ntn[country].powers|=CAPTAIN;
  1755. X            x=CAPTAIN;
  1756. X            CHGMGK;
  1757. X            i++;
  1758. X        }
  1759. X        if(magic(country,WARLORD)!=TRUE){
  1760. X            ntn[country].powers|=WARLORD;
  1761. X            x=WARLORD;
  1762. X            CHGMGK;
  1763. X            i++;
  1764. X        }
  1765. X        printf("\tWarlords have WARRIOR/CAPTAIN/WARLORD power automatically\n");
  1766. X        return(i);
  1767. X    case 8:
  1768. X        printf("\ndemons have the magical DESTROYER power automatically");
  1769. X        ntn[country].powers|=DESTROYER;
  1770. X        x=DESTROYER;
  1771. X        CHGMGK;
  1772. X        return(2);
  1773. X    case 9:
  1774. X        printf("\ndragons have the magical MAJOR MONSTER power automatically");
  1775. X        ntn[country].powers|=AV_MONST;
  1776. X        x=AV_MONST;
  1777. X        CHGMGK;
  1778. X        ntn[country].powers|=MA_MONST;
  1779. X        x=MA_MONST;
  1780. X        CHGMGK;
  1781. X        return(2);
  1782. X    case 10:
  1783. X        printf("\nshadows have the magical VOID power automatically");
  1784. X        ntn[country].powers|=THE_VOID;
  1785. X        x=THE_VOID;
  1786. X        CHGMGK;
  1787. X        return(1);
  1788. X    default:
  1789. X        return(0);
  1790. X    }
  1791. X}
  1792. END_OF_newlogin.c
  1793. if test 28406 -ne `wc -c <newlogin.c`; then
  1794.     echo shar: \"newlogin.c\" unpacked with wrong size!
  1795. fi
  1796. # end of overwriting check
  1797. fi
  1798. echo shar: End of archive 1 \(of 8\).
  1799. cp /dev/null ark1isdone
  1800. MISSING=""
  1801. for I in 1 2 3 4 5 6 7 8 ; do
  1802.     if test ! -f ark${I}isdone ; then
  1803.     MISSING="${MISSING} ${I}"
  1804.     fi
  1805. done
  1806. if test "${MISSING}" = "" ; then
  1807.     echo You have unpacked all 8 archives.
  1808.     rm -f ark[1-9]isdone
  1809. else
  1810.     echo You still need to unpack the following archives:
  1811.     echo "        " ${MISSING}
  1812. fi
  1813. ##  End of shell archive.
  1814. exit 0
  1815.